home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / PDraw3.0.adf / pdraw_rex.lzh / PointsAlign.pdrx < prev    next >
Text File  |  1992-06-15  |  1KB  |  76 lines

  1. /*
  2. @N
  3.  
  4. This Genie will align a selection of points in an object to a user specified position
  5. */
  6.  
  7. msg = PDSetup.rexx(2,0)
  8. units = getclip(pds_units)
  9. if msg ~= 1 then exit_msg(msg)
  10.  
  11. counter = 0
  12. cr = '0a'x
  13.  
  14. do forever
  15.  
  16.     point = pdm_ClickOnPoint("Select points to be aligned..")
  17.     if word(point, 1) = "0" then break
  18.  
  19.     counter = counter + 1
  20.     points.counter = point
  21. end
  22.  
  23. if counter = 0 then exit_msg()
  24.  
  25. selection = "Horizontally"cr"Vertically"
  26. selection = pdm_SelectFromList("Select options..", 25, 3, 0, selection)
  27. if selection = '' then exit_msg()
  28.  
  29. ppos = pdm_GetPoint(word(points.1, 1), word(points.1, 2))
  30. x     = word(ppos, 1)
  31. y     = word(ppos, 2)
  32.  
  33.  
  34. if selection = "Vertically" then 
  35. do
  36.     istring     = "position - hpos, 0"
  37.     position = x
  38. end
  39. else
  40. do
  41.     istring     = "0, position - vpos"
  42.     position = y
  43. end
  44.  
  45. if units = 3 then position = pdm_ConvertUnits(1, units, position)
  46.  
  47. position = pdm_GetForm("Enter alignment position..", 8, "Position:"position)
  48. if position = '' then exit_msg()
  49.  
  50. if ~datatype(position, n) then exit_msg("Invalid entry")
  51. if units = 3 then position = pdm_ConvertUnits(units, 1, position)
  52.  
  53. do i = 1 to counter
  54.  
  55.     obj     = word(points.i, 1)
  56.     pnt     = word(points.i, 2)
  57.     ppos = pdm_GetPoint(obj, pnt)
  58.     hpos = word(ppos, 1)
  59.     vpos = word(ppos, 2)
  60.  
  61.     interpret "call pdm_MovePoint(obj,pnt,"istring")"
  62.  
  63. end
  64.  
  65. exit_msg()
  66.  
  67. exit_msg: procedure expose units
  68. do
  69.     parse arg message
  70.  
  71.     if message ~= '' then call pdm_Inform(1,message,)
  72.     call pdm_SetUnits(units)
  73.     call pdm_AutoUpdate(1)
  74.     exit
  75. end
  76.